Repository navigation
fix: handle file_path=None in MSGToDocument - #13793
Karthik-beta wants to merge 3 commits into
Conversation
|
@Karthik-beta is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||
|
Thanks for checking all the converters, @1AbdullahButt! I went with your first option and added an assertion that |
| assert result["attachments"][0].meta == {"date_added": "2021-09-01T00:00:00", "file_path": "sample_pdf_1.pdf"} | ||
| assert "parent_file_path" not in result["attachments"][0].meta | ||
|
|
||
| def test_run_bytestream_with_null_file_path(self, test_files_path): |
There was a problem hiding this comment.
Lets parametrize test_run_bytestream_without_file_path over meta={} and meta={"file_path": None} instead of adding a new test.
There was a problem hiding this comment.
Done, thanks! test_run_bytestream_without_file_path is now parametrized over meta={} and meta={"file_path": None}, and the separate test is gone. One detail: I switched it from store_full_path=True to the default. With True, the basename call that crashed never runs, so the None case would not catch the bug.
Related Issues
Proposed Changes:
MSGToDocumentno longer crashes when aByteStreamhasfile_path=Nonein its meta. It now uses the same check as the other converters (bytestream.meta.get("file_path")), soNoneis kept in the document meta instead of being passed toos.path.basename.Same fix as #13765 for
XLSXToDocument.How did you test it?
.msgByteStream withfile_path=None. It fails onmainwith theTypeErrorand passes with this change.hatch run test:unit test/components/converters/test_msg_to_document.py: 8 passed.hatch run test:typeson the changed files andruff check/ruff format --check: clean.Notes for the reviewer
Small change. Nothing changes when
file_pathis a real path or missing.This PR was fully generated with an AI assistant. I have reviewed the changes and run the relevant tests.
Checklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:and added!in case the PR includes breaking changes.